package aml.parse;

public class Token {
	public enum  Type {
		EOF, EOL, SYMBOL, NUMBER, STRING, OPERATOR
	}
	
	private Type type;
	private String str;
	
	public Token(Type type, String str) {
		this.type = type;
		this.str = str;
	}

	public Token(Type type) {
		this(type, "");
	}
	
	public Type type() {
		return type;
	}
	
	public String toString() {
		return str;
	}
	
	public static final Token EOF = new Token(Type.EOF);
	public static final Token EOL = new Token(Type.EOL);
	
	public static Token sym(String str) {
		return new Token(Type.SYMBOL, str);
	}
	
	public static Token num(String str) {
		return new Token(Type.NUMBER, str);
	}
	
	public static Token str(String str) {
		return new Token(Type.STRING, str);
	}
	
	public static Token op(String str) {
		return new Token(Type.OPERATOR, str);
	}
}